
package ro.qi.framework.sys.mail.entities;

import java.util.Date;

import ro.qi.framework.sys.entities.Entity;

public class MailMessageCollection extends Entity {

	public MailMessageCollection() {
		super();
	}

	public MailMessageCollection(String to) {
		super();
		setTo(to);
		select();
	}

	public MailMessageCollection(int noMails, int state, Date sendWhen) {
		super();
		setNoMails(noMails);
		setState(state);
		select();
	}

	public void setNoMails(int value) {
		setValue("noMails",value);
	}
	
	public void setState(int value) {
		setValue("state",value);
	}
	
	public void setSendWhen(Date value) {
		setValue("sendWhen",value);
	}
	
	public void setTo(String value) {
		setValue("to", value);
	}
	
	public int getCollectionSize() {
		return getCollectionSize("messages");
	}
	
	public int getId(int index) {
		return getCollectionIntValue("messages", "messageId", index);
	}

	public MailMessage getMessage(int index) {
		return new MailMessage(getId(index));
	}
}
